﻿using System.Collections;
using FlowCanvas.Nodes;
using ParadoxNotion.Design;

namespace Yoozoo.Gameplay.Liberty.Nodes
{
    [Category("Ggame")]
    public class EnterCityScene : LatentActionNode<EnterCityScene.CitySceneType>
    {
        public enum CitySceneType
        {
            SandBox2City = 1,
            Hanging2City = 2,
            
        }

        private bool loaded = false;
        
        // public override void Invoke(CitySceneType sceneType)
        // {
        //     BlueprintUtils.SwitchCityScene(sceneType);
        // }
        public override IEnumerator Invoke(CitySceneType sceneType)
        {
            BlueprintUtils.SwitchCityScene(sceneType,OnLoadComplete);
            yield return new UnityEngine.WaitUntil(() => loaded);
        }

        private void OnLoadComplete()
        {
            loaded = true;
        }
    }
}